import request from '@/axios/axios.js'

// 订单组号列表
export const searchApi = (params) => {
    return request({
        method: 'post',
        url: '/dms/productionOrder/page',
        data: params
    })
}
//关联同组工单
export const associateGroup = (params) => {
    return request({
        method: 'post',
        url: '/dms/productionOrder/associateGroup',
        data: params
    })
}
//取消关联同组工单
export const cancelAssociateGroup = (params) => {
    return request({
        method: 'post',
        url: '/dms/productionOrder/cancelAssociateGroup',
        data: params
    })
}

// 查询已发布BOM物料
export const materialList = (params) => {
    return request({
        method: 'get',
        url: '/dms/process-bom/material-list',
        params: params
    })
};
// 根据物料查询bom版本
export const versionList = (params) => {
    return request({
        method: 'get',
        url: '/dms/process-bom/version-list',
        params: params
    })
};
// 根据BOM ID查询信息
export const bomInfo = (params) => {
    return request({
        method: 'get',
        url: '/dms/process-bom/info',
        params: params
    })
};
// 客户下拉框查询
export const customerList = (params) => {
    return request({
        method: 'get',
        url: '/dms/common/getCustomerNameList',
        params: params
    })
};

// 工序列表
export const procedureList = (params) => {
    return request({
        method: 'get',
        url: '/dms/procedure/list',
        params: params
    })
};


// 仓库下拉框查询
export const queryBackups = () => {
    return request({
        method: 'post',
        url: '/dms/dmsBackupConfig/queryBackups',
    })
};
// 根据当前登陆人查询工厂模型（设备安装位置）
export const findOrgByToken = (params) => {
    return request({
        url: '/basic/organization/findListByToken',
        method: 'get',
        params: params
    })
}
// 新建生产计划
export const addPlan = (params) => {
    return request({
        url: '/dms/production-plan/add',
        method: 'post',
        data: params
    })
}

// 生产计划列表查询
export const planList = (params) => {
    return request({
        url: '/dms/production-plan/list',
        method: 'get',
        params: params
    })
}

// 根据ID查询生产计划信息
export const planInfo = (params) => {
    return request({
        url: '/dms/production-plan/info',
        method: 'get',
        params: params
    })
}

// 强制完工
export const completedPlan = (params) => {
    return request({
        url: '/dms/production-plan/completedPlan',
        method: 'post',
        data: {
            planIdList: params
        }
    })
}

// 关闭计划
export const closePlan = (params) => {
    return request({
        url: '/dms/production-plan/clodePlan',
        method: 'post',
        data: params
    })
}

// 导出
export const exportPlan = (params) => {
    return request({
        url: '/dms/production-plan/export',
        method: 'get',
        responseType: 'blob',
        headers: { withFullResponse: true},
        params: params
    })
}
// 计划下发
export const issuePlan = (params) => {
    return request({
        url: '/dms/production-plan/issue',
        method: 'post',
        data: params
    })
}
// 更新生产计划
export const updatePlan = (params) => {
    return request({
        url: '/dms/production-plan/update',
        method: 'post',
        data: params
    })
}
